import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home'
import Layout from '@/views/Layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    children: [
      {
        // 首页
        path: '/',
        name: 'Home',
        component: Home,
      },
      {
        // 榜单
        path: '/topic',
        name: 'Topic',
        component: () => import('@/views/Topic'),
      },
      {
        // 我的
        path: '/mine',
        name: 'Mine',
        component: () => import('@/views/Mine'),
      },
      {
        // 搜索
        path: '/search',
        name: 'Search',
        component: () => import('@/views/Search'),
      },
    ],
  },
  {
    // 歌单界面
    path:'/more/:id',
    name:'More',
    component:() => import('@/views/MusicMore/MusicMore')
  },
  {
    // 歌曲页面
    path:'/song/:id',
    name:'Songs',
    component:()=>import('@/views/Songs/Songs')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  linkActiveClass:"active"
})

export default router
